package com.woniu.utils;

public class RedisKeyUtil {



    /**
     * 返回一个用来返回用户在一分钟是否发送 过验证码的key
     * @param mobile
     * @return
     */
    public static String registerCodeOnMinute(String mobile){
        return "register:code:minute:mobile:"+mobile;
    }

    /**
     * 返回某手机号在一小时内发送验证码的次数
     * @param mobile
     * @return
     */
    public static String sendMessageNumber(String mobile){
        return "send:message:number:mobile:"+mobile;
    }



    /**
     * 手机号注册业务短信验证码key
     * @param mobile
     * @return
     */
    public static String sendRegisterCodeKey(String mobile){
        return "registerCode:mobile:"+mobile;
    }







    /**
     * 返回用户输入验证码 有误的次数
     * @return
     */

    //登陆是否放松验证码
    public static String loginCodeOnMinute(String mobile){
        return "login:code:minute:mobile:"+mobile;
    }
    public static String codeErrorNumber(String mobile){
        return "code:error:number:mobile:"+mobile;
    }
    //发送登录验证码
    public static String sendLoginCodeKey(String mobile){
        return "login:code:mobile:"+mobile;
    }

    //返回用户的收藏列表的key
    public static String collectList(Integer userId){
        return "collect:userId:"+userId;
    }
    //收藏排行榜
    public static String collectRank(){
        return "collect:rank";
    }
    //返回用户的购物车列表的key
    public static String userShopping(Integer userId){
        return "user:shopping:userid:"+userId;
    }
    //返回 用户购物车详情 的key
    public static String shoppingInfo(Integer userId,Integer bookId){
        return "user:shopping:userid:"+userId+":bookid:"+bookId;
    }


    //返回类别树形缓存数据的key
    public static String cache(){
        return "cache:booktype:tree";
    }

    public static String phoneLock(String phone){
        return "lock:phone:"+phone;
    }

    public static String userNameLock(String username){
        return "lock:username:"+username;
    }

    public static String bookIdLock(String bookId){
        return "lock:bookid:"+bookId;
    }
}
